package com.authine.cloudpivot.ext.service;

import com.authine.cloudpivot.ext.domain.query.MallQuery;
import com.authine.cloudpivot.ext.domain.vo.MallGoodsVO;
import com.authine.cloudpivot.ext.dto.GatewayResponse;
import com.authine.cloudpivot.ext.dto.goods.VendorGoodsEntity;
import com.authine.cloudpivot.ext.dto.system.OrganizationDto;
import com.authine.cloudpivot.ext.entity.goods.GoodsEntity;
import com.authine.cloudpivot.ext.entity.goods.GoodsFullEntity;
import com.authine.cloudpivot.ext.model.goods.MallGoodsModel;
import org.springframework.web.bind.annotation.RequestBody;

import java.math.BigDecimal;
import java.util.Collection;
import java.util.List;
import java.util.Map;

public interface GoodsService {


    /**
     * 添加历史记录
     *
     * @param oldList
     */
    void addGoodsHistory(List<Map<String, Object>> oldList);

    /**
     * 查询供应商下相同的商品
     *
     * @param vendorId
     * @param name
     * @param brand
     * @param model
     * @param spec
     * @param unit
     * @param packageUnit
     * @param packageNum
     * @return
     */
    List<VendorGoodsEntity> queryEqualGoods(String vendorId, String name, String brand, String model,
                                            String spec, String unit, String packageUnit, BigDecimal packageNum);

    /**
     * 批量添加和保存
     */
    boolean insertAndUpdateList(List<Map<String, Object>> insert, List<Map<String, Object>> update);

    /**
     * 税后商品单价
     *
     * @param model
     * @param customerAccount
     * @param vendor
     * @return
     */
    BigDecimal calculateSkuPrice(GoodsFullEntity model, OrganizationDto customerAccount, OrganizationDto vendor);


    /**
     * 根据商品id查询商品详情
     */
    GatewayResponse<List<GoodsFullEntity>> pageMallGoodsByIds(List<String> ids, Boolean restrictedBrands);

    Collection<String> majorBrandFilter(String majorBrand);

    /**
     * 修改商品
     *
     * @param map
     * @return
     */
    boolean updateGoods(Map<String, Object> map);

    GoodsEntity getGoodsById(String id);

    /**
     * 分页查商城商品
     *
     * @param query
     * @return
     */
    GatewayResponse<MallGoodsVO> pageMallGoods(MallQuery query);

    /**
     * 商城商品查询
     *
     * @param query
     * @return
     */
    MallGoodsModel pageMallFullGoods(@RequestBody MallQuery query);
}
